﻿
Namespace storageJobConsumerInternal
    Public Class diskslice1
        Inherits diskslice(Of atom)

        Public Sub New()
            MyBase.New(False)
        End Sub

        Protected Overrides Function metaLength(ByVal buff As bytes) As UInt64
            Return buff.size()
        End Function

        Protected Overrides Function meta(ByVal atom As atom, ByVal buff As bytes) As bytes
            Return buff
        End Function

        Protected Overrides Function read(ByVal atom As atom,
                                          ByVal result As pointer(Of bytes)) As eventComb
            Dim ec As eventComb = Nothing
            If readstream4(stream(),
                           atom.metaStart(),
                           atom.metaLength(),
                           holdtime:=diskslice.diskOperDefaultHoldtimeMs,
                           ec:=ec,
                           result:=result) Then
                Return ec
            Else
                eva(result, [default](Of bytes))
                Return Nothing
            End If
        End Function

        Protected Overrides Function sizeof(ByVal atom As atom) As Int64
            Return atom.metaLength()
        End Function

        Protected Overrides Function version() As String
            Return "Hzj_jie-Gemini-AllInOne"
        End Function

        Public Shared Shadows Function initial(ByVal name As String,
                                               ByVal config As configParser,
                                               ByVal c As diskslice1) As Boolean
            Return diskslice(Of atom).initial(name, config, c)
        End Function
    End Class
End Namespace
